<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <div id="app">
        <h1>遍历数组</h1>
        <ul>
            <li v-for="u of users" :key="u.id">
                {{u.name}} : {{u.age}}
            </li>
        </ul>
        <h1>遍历对象</h1>
        <ul>
            <li v-for="(value, key) in car" :key="key">
                {{key}} : {{value}}
            </li>
        </ul>
        <h1>遍历字符串</h1>
        <ul>
            <li v-for="(char, index) in str" :key="index">
                {{char}} : {{index}}
            </li>
        </ul>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                users: [
                    {id:'001',name:'张三',age:18},
					{id:'002',name:'李四',age:19},
					{id:'003',name:'王五',age:20}
                ],
                car: {
                    name:'奥迪A8',
					price:'70万',
					color:'黑色'
                },
                str: 'hello world'
            }
        })
    </script>
</body>
</html>